package com.weiwei.diancan.adapter;

import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.weiwei.diancan.R;
import com.weiwei.diancan.bean.JiluBean;

import java.util.List;

/**
 * Created by BMW on 2017/1/13.
 */
public class CaozuoAdapter extends RecyclerView.Adapter<CaozuoAdapter.MyVH> {

    private List<JiluBean.ListBean> list;

    public CaozuoAdapter(List<JiluBean.ListBean> list){
        this.list = list;
    }

    @Override
    public MyVH onCreateViewHolder(ViewGroup parent, int viewType) {
        return new MyVH(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_caozuo,parent,false));
    }

    @Override
    public void onBindViewHolder(MyVH holder, int position) {
        holder.tv.setText(list.get(position).getLog_desc());
    }

    @Override
    public int getItemCount() {
        return list.size();
    }

    static class MyVH extends RecyclerView.ViewHolder{
        private TextView tv;
        public MyVH(View itemView) {
            super(itemView);
            tv = (TextView)itemView.findViewById(R.id.tv);
        }
    }
}
